const jwt = require('koa-jwt')
const Router = require('koa-router');
const router=new Router({prefix:'/questions'});
const {find, findById, create,update,delete:del,checkQuestioner,checkQuestionExist} =require('../controllers/question')
const {secret} =require('../config');
const auth = jwt({secret})
router.get('/',find)//用户
router.post('/',auth,create)//创建
router.get('/:id',checkQuestionExist,findById)//查询
router.patch('/:id',auth,checkQuestionExist,checkQuestioner,update)
router.delete('/:id',auth,checkQuestionExist,checkQuestioner,del)




module.exports=router;